import React, { Component } from 'react'

export default class  extends Component {
  state={
    count:6
  }
  f1=()=>{
    let count=this.state.count-1    
    this.setState({count},()=>{
      console.log(this.state); 
    })
  }
  f2=()=>{
    let count=this.state.count + 1
    this.setState({count},()=>{
      console.log(this.state); 
    })
   
  }
  render() {
    return (
      <div>
        <button onClick={this.f1}>-</button>
        <span>{this.state.count}</span>
        <button onClick={this.f2}>+</button>

      </div>
    )
  }
}


